import static org.junit.Assert.*;
import org.junit.Test;
/**
 * Created by radish608 on 17-4-21.
 */
public class ComplexTest {
    @Test
    public void Complex(){
        
        Complex num1 = new Complex();
        assert num1.getA() == 0 : "error1:Complex()";
        assert num1.getA() == 0 : "error2:Complex()";

        Complex num2 = new Complex(0, 0);
        assert num2.getA() == 0 : "error3:Complex(double a,double b)";
        assert num2.getB() == 0 : "error4:Complex(double a,double b)";

        Complex num3 = new Complex();
        num3.setA(0);
        assert num3.getA() == 0 : "error7:setA(double a)";

        num3.setB(0);
        assert num3.getB() == 0 : "error8:setB(double b)";

        Complex num4 = new Complex();
        Complex num5 = new Complex(-1, -1);
        Complex num6 = new Complex();
        num4 = num1.ComplexAdd(num1);
        assert num4.getA() == 0 : "error9:ComplexAdd(Complex c)";
        assert num4.getB() == 0 : "error10:ComplexAdd(Complex c)";
        num6 = num1.ComplexAdd(num5);
        assert num6.getA() == -1 : "error11:ComplexAdd(Complex c)";
        assert num6.getB() == -1 : "error12:ComplexAdd(Complex c)";

        Complex num7 = new Complex();
        Complex num8 = new Complex(1, 1);
        Complex num9 = new Complex();
        num7 = num1.ComplexMinus(num1);
        assert num7.getA() == 0 : "error13:ComplexMinus(Complex c)";
        assert num7.getB() == 0 : "error14:ComplexMinus(Complex c)";
        num9 = num1.ComplexMinus(num8);
        assert num9.getA() == 1 : "error13:ComplexMinus(Complex c)";
        assert num9.getB() == 1 : "error14:ComplexMinus(Complex c)";

        Complex num10 = new Complex();
        Complex num11 = new Complex(-1, -1);
        Complex num12 = new Complex();
        Complex num13 = new Complex();
        Complex num14 = new Complex(1, 1);
        num10 = num1.ComplexMulti(num1);
        assert num10.getA() == 0 : "error15:ComplexMulti(Complex c)";
        assert num10.getB() == 0 : "error16:ComplexMulti(Complex c)";
        num12 = num1.ComplexMulti(num11);
        assert num12.getA() == 0 : "error17:ComplexMulti(Complex c)";
        assert num12.getB() == 0 : "error18:ComplexMulti(Complex c)";
        num13 = num11.ComplexMulti(num14);
        assert num13.getA() == -1 : "error19:ComplexMulti(Complex c)";
        assert num13.getB() == -1 : "error20:ComplexMulti(Complex c)";

        System.out.println("Pass!");
    }
}